<?php

if ($give_to == "Give to name in field below")
{
	$give_to2 = strtolower(ereg_replace(" ", "", "$give_to2"));
	$findUser = fetch("SELECT id FROM members2 WHERE username = '$give_to2' AND game = '$game'");
	$give_to = $findUser[id];
}

$findUser = fetch("SELECT id,username,display_name FROM members2 WHERE id = '$give_to' AND game = '$game'");
if (!$findUser[id])
{
	die("

	<br><center>
		<table width=380 cellspacing=0>
		<tr>
		<td bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Selected Item</font></b></center>
		</td>
		<td width=300 bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Item Details</font></b></center>
		</td>
		</tr>
		<tr height=100>
		<td valign=middle>
		<p align=center><img src=images/user_images/opg_$game/items/item_$find_item2[id].gif>
		<br>
		<b>$find_item2[item_name]</b>
		</td>
		<td width=300>
		<p align=center>Your $find_item2[item_name] could not be given to $findUser[display_name], because that user does not exsist.<br><A href=myitems.php?game=$game>Back to my items.</a>
		</p>
		</td>
		</tr>
		</table>
		</center>

	");
}

mysql_query("DELETE FROM usersitems2 WHERE id = '$id' AND owner = '$userid' AND game = '$game'");
mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$findUser[id]','$find_item2[id]','$find_item[parts_left]','$game')");

systemmessage("$game", "myitems.php?game=$game", "$findUser[id]", "$display_name has given you a $find_item2[item_name]!!");

print "
		<br><center>
		<table width=380 cellspacing=0>
		<tr>
		<td bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Selected Item</font></b></center>
		</td>
		<td width=300 bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Item Details</font></b></center>
		</td>
		</tr>
		<tr height=100>
		<td valign=middle>
		<p align=center><img src=images/user_images/opg_$game/items/item_$find_item2[id].gif>
		<br>
		<b>$find_item2[item_name]</b>
		</td>
		<td width=300>
		<p align=center>You have given your $find_item2[item_name] to $findUser[display_name]!<br><A href=myitems.php?game=$game>Back to my items.</a>
		</p>
		</td>
		</tr>
		</table>
		</center>
";

?>